{% extends "base_site.html" %}

{% block title %}Rolodex - View{% endblock %}

{% block breadcrumbs %}{{ block.super }}
    &raquo; <a href="../">Rolodex</a>
    &raquo; {{ person.name }}
{% endblock %}

{% block content %}
    <div class="module">
        <h2>{{ person.name }} ({{ person.id }})</h2>


        <table id="rolodex-view-table" class="full-width">
            <tbody>
            <tr><td>Name:</td><td>{{ person.name }}</td></tr>
            <tr><td>Ascii Name:</td><td>{{ person.ascii }}</td></tr>
            <tr><td>Short Name:</td><td>{{ person.ascii_short }}</td></tr>
            <tr><td>Aliases:</td><td>{% for alias in person.alias_set.all %}{% if not forloop.first %}, {% endif %}{{ alias.name }}{% endfor %}</td></tr>
                <tr><td>User:</td><td>{{ person.user }}</td></tr>
                <tr><td></td><td></td></tr>
                {% for email in person.emails %}
                    <tr><td>Email {{ forloop.counter }}:</td><td>{{ email }}</td></tr>
                {% endfor %}
                </tbody>
            </table>
                <br>

                <div class="inline-related">
                    <h2><b>Roles</b></h2>
                    <table id="rolodex-role-table" class="full-width">
                        <thead>
                            <tr>
                                <th scope="col">Role Name</th>
                                <th scope="col">Group / Area</th>
                                <th scope="col">Email</th>
                            </tr>
                        </thead>
                        {% if roles %}
                            <tbody>
                                {% for role in roles %}
                                    <tr>
                                        <td>{{ role.name }} </td>
                                        <td>
                                            {% if role.group.type.slug == "area" %}
                                                {{ role.group.acronym }}{% if role.group.state.slug == "conclude" %} (concluded){% endif %}
                                            {% else %}
                                                <a href="{% url 'ietf.group.views.group_home' acronym=role.group.acronym %}">{{ role.group.acronym }}{% if role.group.state.slug == "conclude" %} (concluded){% endif %}</a>
                                            {% endif %}
                                        </td>
                                        <td>{{ role.email }}</td>
                                    </tr>
                                {% endfor %}
                            </tbody>
                        {% endif %}
                    </table>
                </div> <!-- iniline-related -->

                <div class="button-group">
                    <ul>
                        <li><button type="button" onclick="window.location='../'">Search</button></li>
                        <li><button type="button" onclick="window.location='edit/'">Edit</button></li>
                        {% comment %}
    Removed per Glen
    <li><button type="button" onclick="window.location='../../delete/{{ person.person_or_org_tag }}'">Delete</button></li>
    {% endcomment %}
                    </ul>
                </div> <!-- view-buttons -->

            </div> <!-- view-container -->
        {% endblock %}
